From d6f07c640a520903a9c3832ad51628b19abacfdb Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Wed, 12 Apr 2017 13:50:35 +0000 Subject: [PATCH] x86/asm: Fold LOAD_C_CLOBBERED into RESTORE_ALL With its sole other user removed, fold LOAD_C_CLOBBERED into RESTORE_ALL to reduce the cognitive load of trying to work out which registers get modified. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich Reviewed-by: Wei Liu Release-acked-by: Julien Grall --- xen/include/asm-x86/asm_defns.h | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/xen/include/asm-x86/asm_defns.h b/xen/include/asm-x86/asm_defns.h index f1c6fa1f8e..11306d1e90 100644 --- a/xen/include/asm-x86/asm_defns.h +++ b/xen/include/asm-x86/asm_defns.h @@ -321,40 +321,25 @@ static always_inline void stac(void) .endif /* - * Reload registers not preserved by C code from frame. - * - * @compat: R8-R11 don't need reloading + * Restore all previously saved registers. * - * For the way it is used in RESTORE_ALL, this macro must preserve EFLAGS.ZF. + * @adj: extra stack pointer adjustment to be folded into the adjustment done + * anyway at the end of the macro + * @compat: R8-R15 don't need reloading */ -.macro LOAD_C_CLOBBERED compat=0 ax=1 +.macro RESTORE_ALL adj=0 compat=0 .if !\compat + testl $TRAP_regs_dirty,UREGS_entry_vector(%rsp) movq UREGS_r11(%rsp),%r11 movq UREGS_r10(%rsp),%r10 movq UREGS_r9(%rsp),%r9 movq UREGS_r8(%rsp),%r8 .endif -.if \ax LOAD_ONE_REG(ax, \compat) -.endif LOAD_ONE_REG(cx, \compat) LOAD_ONE_REG(dx, \compat) LOAD_ONE_REG(si, \compat) LOAD_ONE_REG(di, \compat) -.endm - -/* - * Restore all previously saved registers. - * - * @adj: extra stack pointer adjustment to be folded into the adjustment done - * anyway at the end of the macro - * @compat: R8-R15 don't need reloading - */ -.macro RESTORE_ALL adj=0 compat=0 -.if !\compat - testl $TRAP_regs_dirty,UREGS_entry_vector(%rsp) -.endif - LOAD_C_CLOBBERED \compat .if !\compat jz 987f movq UREGS_r15(%rsp),%r15 -- 2.30.2